function videoMonitorCtrl($rootScope, $scope, $http, $document) {
  'ngInject';

  this.queryParams = {
    params: {
      tenderId: '',
      index: 0,
      size: 50,
    }
  }
  
  this.queryDeviceList = () => {
    this.deviceList = [];
    $http
      .get(`${SERVER_CONTEXT}/api/ys/camera/list`, this.queryParams)
      .success((resp) => {
        if (resp.data) {
          if (this.queryParams.params.tenderId == '5BED013543A245028CFFC00A19B02133') {
            resp.data.forEach((item) => {
              if (item.channelName == '视频1@DS-7104N-SN-N(510975526)') {
                item.channelName = '镇江新区南互通';
                this.deviceList.push(item);
              } else if (item.channelName == '视频1@DS-7104N-SN(583813755)') {
                item.channelName = '大港疏纽';
                this.deviceList.push(item);
              }
            })
          } else {
            this.deviceList = resp.data;
          }
        }       
      })
  }

  this.watchTV = (deviceInfo) => {
    $http
      .get(`${SERVER_CONTEXT}/api/ys/live/address/get`, {
        params: {
          tenderId: $rootScope.activeBid.bidId,
          deviceSerial: deviceInfo.deviceSerial,
          channelNo: deviceInfo.channelNo,
          expireTime: 2592000,  // 3天
        }
      })
      .success((resp) => {
        if (resp.success) {
          let m3u8Url = resp.data.liveAddress;
          if (!m3u8Url) {
            layer.alert('当前设备不在线,无法直播');
            return fasle;
          }
          let url = $state.href('live', {address: m3u8Url});
          window.open(url)
        } else {
          layer.alert(resp.message);
        }
      });
  }

}

export default videoMonitorCtrl;